#pragma once

// 底盘
#include "base_component.h"

class Chasis : public BaseComponent {
public:
    Chasis();
    void setChasisId(std::string Id);
    void setChasisModel(std::string model);
    void setWheelBase(int wheelBase);
    void setGroundClearance(int groundClearance);
    void setTurningRadius(float turningRadius);
    void print() override;
    int save(YAML::Node& node) override;

private:
    std::string _chasisId;
    std::string _chasisModel;
    int _wheelBase;
    int _groundClearance;
    float _turningRadius;
};

namespace YAML {
template <>
struct convert<Chasis> {
    // 反序列化方法
    static bool decode(const Node& node, Chasis& obj) {
        obj.setChasisId(node["chasisId"].as<std::string>());
        obj.setChasisModel(node["chasisModel"].as<std::string>());
        obj.setWheelBase(node["wheelBase"].as<int>());
        obj.setGroundClearance(node["groundClearance"].as<int>());
        obj.setTurningRadius(node["turningRadius"].as<float>());
        return true;
    }
};
}  // namespace YAML